#include "StdAfx.h"
#include "Station.h"
#include "StrUntils.h"
#include <list>
#include <assert.h>

CStation::CStation(LPCTSTR nameAddr)
{
    m_Name = new TCHAR[256];
    m_IPAddr = new TCHAR[256];
    m_portStr = new TCHAR[256];

    assert(nameAddr);

    std::list<CString> list;
    CStrUntils::CStringSplit(nameAddr, _T("@:"), list);
    assert(list.size() == 3);

    LPTSTR tmpArray[] = {m_Name, m_IPAddr, m_portStr};
    int i = 0;
    std::list<CString>::iterator it = list.begin();
    for (; it != list.end(); it++, i++){
        CStrUntils::CString2LPTSTR(tmpArray[i], *it);
    }
}

CStation::~CStation(void)
{
    delete[] m_Name;
    delete[] m_IPAddr;
    delete[] m_portStr;
}

LPCTSTR CStation::getName(){
    return m_Name;
}

